package main

import (
	"fmt"
	"reflect"
)

type User struct {
	Name string
	Age  int
}

func student() {
	fmt.Println("test")
}

func reflectSetValue1(x interface{}) {
	v := reflect.ValueOf(x)
	if v.Kind() == reflect.Int64 {
		v.SetInt(200)
	}
}
func reflectSetValue2(x interface{}) {
	v := reflect.ValueOf(x)
	if v.Kind() == reflect.Int64 {
		v.Elem().SetInt(200)
	}
}
func main() {

	var a int64 = 1000

	b := make([]string, 1)
	reflectSetValue1(&a)
	fmt.Println(a)
	c := student

	fmt.Println(reflect.ValueOf(b).IsNil())
	fmt.Println(reflect.ValueOf(c).IsNil())

	u := User{"Greg", 30}
	x := reflect.TypeOf(u)
	y := reflect.ValueOf(u)
	fmt.Println(x.Name())
	fmt.Println(y.Field(1).Interface())

}
